home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 4 / QRZ Ham Radio Callsign Database - Volume 4.iso / files / dsp / 56ktools / a5611.tz / a5611 / toomf.c < prev    next >
C/C++ Source or Header  |  1992-08-11  |  2KB  |  61 lines

  1. /*******************************************************
  2.  *
  3.  *  a56 - a DSP56001 assembler
  4.  *
  5.  *  Written by Quinn C. Jensen
  6.  *  July 1990
  7.  *  jensenq@npd.novell.com (or jensenq@qcj.icon.com)
  8.  *
  9.  *******************************************************\
  10.  
  11. /*
  12.  * Copyright (C) 1990-1992 Quinn C. Jensen
  13.  *
  14.  * Permission to use, copy, modify, distribute, and sell this software
  15.  * and its documentation for any purpose is hereby granted without fee,
  16.  * provided that the above copyright notice appear in all copies and
  17.  * that both that copyright notice and this permission notice appear
  18.  * in supporting documentation.  The author makes no representations
  19.  * about the suitability of this software for any purpose.  It is
  20.  * provided "as is" without express or implied warranty.
  21.  *
  22.  */
  23. static char *Copyright = "Copyright (C) 1990-1992 Quinn C. Jensen";
  24.  
  25. /*
  26.  *  This small program converts the a56.out file from the assembler
  27.  *  into a file suitable for loading into 56001 memory via the
  28.  *  SLOADER.ASM serial loader program provided on the Motorola
  29.  *  Dr. Bubb BBS.
  30.  *
  31.  */
  32.  
  33. #define MAX 256
  34.  
  35. main(argc,argv)
  36. int argc;
  37. char *argv[];
  38. {
  39.     char buf[MAX];
  40.     int curaddr = 0;
  41.     int line = 0;
  42.     int curseg = '\0';
  43.     int startaddr = -1;
  44.  
  45.     while(gets(buf)) {
  46.     char seg;
  47.     int addr, data;
  48.     line++;
  49.     if(sscanf(buf, "%c%x%x", &seg, &addr, &data) == 3) {
  50.         if(seg != curseg || curaddr != addr) {
  51.         printf("\n_DATA %c %04X\n", curseg = seg, curaddr = addr);
  52.         }   
  53.         if(startaddr == -1 && seg == 'P')
  54.         startaddr = addr;
  55.         printf("%06X ", data & 0xFFFFFF);
  56.         curaddr++;
  57.     }
  58.     }
  59.     printf("\n_END %04X\n", startaddr);
  60. }
  61.